package Qverst::CSS::Optimize;
use Moose;
use CSS::Utils::Walk;

with  'CSS::Optimize::Color';
      #'CSS::Optimize::Margin' ,
      #'CSS::Optimize::List';
        
has tree    => ( isa => 'CSS::Builder::Document' , is => 'rw' , required => 1 );
has mode    => ( isa => 'Str' , is => 'rw' , default => 'normal' );

# NOTE:
# simple optimize method, optimizing properties only within class
# so it's not used for moving prop's, etc

sub simple {
    my $self = shift;
    
    my $walker = CSS::Utils::Walk->new( tree => $self->tree );
    
    $walker->walk(
        sub {
            my $tree = shift;
            
            return unless $tree->isa('CSS::Builder::Style');
            
            if ($tree->value and $tree->value->isa('CSS::Builder::Value::Color')) {
                $self->optimize_color($tree->value , $self->mode);
            }
            
        }
    );
}

sub advanced {
    my $self = shift;
}

sub complex {
    my $self = shift;
}


1;
